while and do …. while
Pascal
C/C++
w
while x < y do
w
x := 2 * x
while (x < y)
x = 2 * x;
repeat
x := 2 * x;
y := y – 1
until x >= y
do {
y = 2 * x;
y--;
} while (x < y);
NOTE:
The sense of the condition is the opposite from
Pascal.
l
The sense of the condition is the opposite from Pascal. C is consistent about always requiring compound statements to be surrounded by braces.